Imports System.Data
Partial Class Client_frmGallery
    Inherits System.Web.UI.Page
    Dim _UserId As String
    Dim _bo As New Bo
    Dim dt As New DataTable
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        _UserId = Session("UserId")
        dt = _bo.brand()
        DataList.DataSource = dt
        DataList.DataBind()

        If Not Page.IsPostBack Then
            If _UserId Is Nothing Then
                imgbtn.ImageUrl = "~/images//login.jpg"
                DataList1.Visible = "false"
                imgCart.Visible = "true"
                Table1.Visible = "false"
            Else
                imgbtn.ImageUrl = "~/images/logout.jpg"
            End If
            If _UserId <> Nothing Then
                imgCart.Visible = "false"
                imgbtn.ImageUrl = "~/images/logout.jpg"
                DataList1.Visible = "true"
                Call cartdetail()
            End If
        End If





        'If Not Page.IsPostBack Then
        '    If _UserId Is Nothing Then
        '        imgbtn.ImageUrl = "~/images//login.jpg"
        '    Else
        '        imgbtn.ImageUrl = "~/images/logout.jpg"
        '    End If
        'End If
    End Sub
    Protected Sub DataList_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles DataList.EditCommand
        If e.CommandName = "Edit" Then
            Dim lnk1 As LinkButton = e.Item.FindControl("Lnk")
            Response.Redirect("BrandWiseProducts.aspx.aspx?Brand=" & lnk1.Text)
        End If
    End Sub
    Protected Sub imgbtn_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgbtn.Click
        If _UserId Is Nothing Then
            Response.Redirect("~/Client/frmLogin.aspx")
        Else
            Response.Redirect("~/Client/frmLogout.aspx")
        End If
    End Sub
    Sub cartdetail()
        Dim dt1 As New DataTable
        dt1 = _bo.getcart
        Dim dt2 As New DataTable
        dt2 = _bo.getTotalQuantity
        If dt1.Rows.Count = 0 Then
            lbl1.Text = "There Are No Items In Your Bag"
        Else
            lbl1.Text = "You Have " & dt2.Rows(0).Item(0).ToString & " Item(s) In Your Bag"
            DataList1.DataSource = dt1
            DataList1.DataBind()
        End If
    End Sub
    Protected Sub imgGallery_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgGallery.Click
        Response.Redirect("../Client/frmDataList.aspx")
    End Sub

    Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
        Response.Redirect("../Client/frmShowFeeds.aspx")
    End Sub
End Class